﻿/********************************************************************************
** @ Date:2023/11/22
** @ Author: Gaojia
** @ Description: 自定义表格控件B
** @ Version:1.0.0
** @ Fun:
********************************************************************************/
#ifndef CTableWidgetB_H
#define CTableWidgetB_H
#include <qtablewidget.h>
#include <QLabel>
#include <QPushButton>
#include <QHeaderView>
#include <QVector>

class CTableWidgetB :
	public QTableWidget
{
	Q_OBJECT

	/**
	* @ Author: hanjiaxing
	* @ Description: 摄像头报警记录查询
	*/
	struct MyStructViderAlarmItem
	{
		QLabel    *     m_pLabIndex;     //序号
		QLabel    *     m_pCamerName;    //摄像头名称
		QLabel    *     m_pAlarmType;  //报警类型
		QLabel    *     m_pAlarmTime; //报警时间
		QLabel    *     m_pAlarmLevel;  //报警等级
		QLabel    *     m_pIsConfirm;  //是否确认
		QPushButton*    m_pBtnView;	   //查看

		MyStructViderAlarmItem()
		{
			m_pLabIndex = new QLabel();
			m_pCamerName = new QLabel();
			m_pAlarmType = new QLabel();
			m_pAlarmTime = new QLabel();
			m_pAlarmLevel = new QLabel();
			m_pIsConfirm = new QLabel();
			m_pBtnView = new QPushButton();

			m_pLabIndex->setAlignment(Qt::AlignCenter);
			m_pCamerName->setAlignment(Qt::AlignCenter);
			m_pAlarmType->setAlignment(Qt::AlignCenter);
			m_pAlarmTime->setAlignment(Qt::AlignCenter);
			m_pAlarmLevel->setAlignment(Qt::AlignCenter);
			m_pIsConfirm->setAlignment(Qt::AlignCenter);
			m_pBtnView->setText(QString::fromLocal8Bit("查看明细"));

			m_pLabIndex->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pLabIndex->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pLabIndex->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pCamerName->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pCamerName->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pCamerName->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pAlarmType->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pAlarmType->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pAlarmType->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pAlarmTime->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pAlarmTime->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pAlarmTime->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pAlarmLevel->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pAlarmLevel->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pAlarmLevel->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pIsConfirm->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pIsConfirm->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pIsConfirm->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pBtnView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
		}
	};

	struct MyStructResultItem
	{
		QLabel    *     m_pLabIndex;     //序号
		QLabel    *     m_pResultName;    //报告名
		QLabel    *     m_pReslutTime;  //生成时间
		QLabel    *     m_pPath; //保存路径
		QPushButton*    m_pBtnView;	   //查看

		MyStructResultItem()
		{
			m_pLabIndex = new QLabel();
			m_pResultName = new QLabel();
			m_pReslutTime = new QLabel();
			m_pPath = new QLabel();
			m_pBtnView = new QPushButton();

			m_pLabIndex->setAlignment(Qt::AlignCenter);
			m_pResultName->setAlignment(Qt::AlignCenter);
			m_pReslutTime->setAlignment(Qt::AlignCenter);
			m_pPath->setAlignment(Qt::AlignCenter);
			m_pBtnView->setText(QString::fromLocal8Bit("查看"));

			m_pLabIndex->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pLabIndex->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pLabIndex->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pResultName->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pResultName->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pResultName->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pReslutTime->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pReslutTime->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pReslutTime->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pPath->setStyleSheet("background-color: transparent;color: rgb(0, 0, 0);border: none;outline: none;");
			m_pPath->setFocusPolicy(Qt::NoFocus); // 禁用焦点
			m_pPath->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
			m_pBtnView->setSizePolicy(QSizePolicy::Preferred, QSizePolicy::Expanding);
		}
	};

public:
	CTableWidgetB(QWidget *parent);
	~CTableWidgetB();
	void InitUi(int nType);//初始化界面
	void InitData(int nType, QVector<QVector<QString>>vecStr);          //表格类型
	QVector<QVector<QString>>m_vecvStr;
	int m_nDataType;//表格类型
public slots:
	void slotClickedShowImg();//展示图片
	void slotClickedShowResult();//查询报告对话框
signals:
	void sigShowImg(QString sHttpUrl);
	void sigShowResult(QString sPath);
};

#endif